package com.multithreading.Thread_005;

/**
 * @author zx
 * @version 1.0
 * @package_name: com.multithreading.Thread_005
 * @date 2024/5/13 18:14
 */
public class ThreadDemo {
    public static void main(String[] args) {
        // 创建线程要执行的对象
        MyRunnable myRunnable = new MyRunnable();
        // 创建线程
        Thread thread1 = new Thread("飞机");
        Thread thread2 = new Thread("坦克");

        System.out.println("更改前线程 thread1 的优先级 "+thread1.getPriority());
        System.out.println("更改前线程 thread2 的优先级 "+thread2.getPriority());
        // 设置优先级
        thread1.setPriority(Thread.MAX_PRIORITY);
        thread2.setPriority(Thread.MIN_PRIORITY);
        // 更改后线程优先级
        System.out.println("更改后线程 thread1 的优先级 "+thread1.getPriority());
        System.out.println("更改后线程 thread2 的优先级 "+thread2.getPriority());

        System.out.println("线程1名称：" + thread1.getName());
        System.out.println("线程2名称：" + thread2.getName());
    }
}
